/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DBFunction;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import Constant.Constant;

public class fInsertMessage {
	public static void process(String MessageJsonString) throws JSONException {
		JSONObject object = new JSONObject();
		object = (JSONObject) new JSONTokener(MessageJsonString).nextValue();
		String phoneNumber = object.getString("phonenumber");		
		String content = object.getString("msgcontent");		
		String time = Constant.getDateTime();		
		String sql = "insert into buddytracking.message (message.UserId,message.Time,message.Content) values((SELECT UserId from buddytracking.user where  user.PhoneNumber=\""+phoneNumber+"\") ,\""+time+"\",\""+content+"\")";
		DB.connectDB.Update(sql);
	}
}
